﻿using Common.ViewModels;
using Common.Views;
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace AWSV2.ViewModels
{
    public class WeighPlanDialogViewModel : Screen
    {
        public event EventHandler Closed;

        /// <summary>
        /// 控件初始化之后赋值 --阿吉 2025年1月17日20点44分
        /// </summary>
        private Window _windowIns;

        public void WindowLoaded(object sender, RoutedEventArgs e)
        {
            _windowIns = (Window)sender;
        }

        private WeighPlanListViewModel _weighPlan;
        public WeighPlanListViewModel WeighPlan 
        { get => _weighPlan; set => SetAndNotify(ref _weighPlan, value); }

        public WeighPlanDialogViewModel(IWindowManager windowManager)
        {
            WeighPlan  = new WeighPlanListViewModel(windowManager);
        }

        protected override void OnClose()
        {
            base.OnClose();
            Closed?.Invoke(this, new EventArgs());
        }

        public void ActiveWindow()
        {
            _windowIns?.Activate();
        }
    }
}
